package cn.zwx.common.limiter.enums;

import java.util.Objects;

/**
 * @author zhangwenxue
 */
public enum LimiterTypeEnum {
    /**
     * memory
     */
    memory(1,"memory"),
    /**
     * redis
     */
    redis(2,"redis"),
    ;
    private int code;

    private String msg;

    public static LimiterTypeEnum of(String type) {
        for(LimiterTypeEnum limiterTypeEnum :LimiterTypeEnum.values()){
            if (Objects.equals(limiterTypeEnum.msg, type)){
                return limiterTypeEnum;
            }
        }
        return null;
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    LimiterTypeEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

}
